package org.lmind.srd35.world

trait Existence {

  var _position: (Int, Int) = (0, 0)
  var _world: World = null

  def position = _position
  def position_=(v: (Int, Int)) = _position = v

  def world = _world
  def world_=(v: World) = _world = v
  
  def distanceOf(pos: (Int, Int)) =
    Math.abs(position._1 - pos._1) + Math.abs(position._2 - pos._2)
    
  def distanceOf(other: Existence): Int = distanceOf(other.position)
}